/**
 * Company : Thai Informatic System Co., Ltd.
 * Created By : Dr.Tree
 * Created On : Mar 15, 2012  12:16:44 PM 
 * e-Mail : chatree@tis.co.th
 * Mobile Phone : (+66) 087-921-5115
 * Package Name : jpa.service.promis.construction
 * File Name : VwSyncMktCustomerServices.java
 * TODO
 */
package jpa.service.promis.common;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.persistence.EntityManager;

import jpa.entitys.promis.sales.VwSyncMktCustomer;
import jpa.service.common.JPAService;

/**
 * @author chatree
 *
 */
public class VwSyncMktCustomerServices extends JPAService {

	/**
	 * @param em
	 */
	public VwSyncMktCustomerServices(EntityManager em) {
		super(em);
		// TODO Auto-generated constructor stub
	}
	

	public VwSyncMktCustomer findById(String id) throws Exception {		
	
		return super.ConvertToYoureObject(super.find(id, "VwSyncMktCustomer.findById"));				
	}
	
	public List<VwSyncMktCustomer> findAll() throws Exception 
	{
		return super.ConvertToYoureObject(super.findAll("VwSyncMktCustomer.findAll"));
	}

//	public List<SyncPr> findByPrimary(PurchaseRequestPK purchaseRequestPK) throws Exception {
//		Map<String,Object> mapWhereValue = new HashMap<String, Object>();
//		mapWhereValue.put("company", purchaseRequestPK.getCompany());
//		mapWhereValue.put("project", purchaseRequestPK.getProject());
//		mapWhereValue.put("porType", purchaseRequestPK.getPorType());
//		mapWhereValue.put("porNo", purchaseRequestPK.getPorNo());
//		mapWhereValue.put("porSeries", purchaseRequestPK.getPorSeries());
//		
//		return super.ConvertToYoureObject(super.find("SyncPr.findByPrimary", mapWhereValue));
//		
//	}
	
	public List<VwSyncMktCustomer> findByCustomerNo(String customerCode, String syncIsstaging) throws Exception {
		Map<String,Object> mapWhereValue = new HashMap<String, Object>();				
		mapWhereValue.put("customerCode", customerCode);
		mapWhereValue.put("syncIsstaging", syncIsstaging);
		//mapWhereValue.put("status", status);
		
		return super.ConvertToYoureObject(super.find("VwSyncMktCustomer.findByCustomerNo", mapWhereValue));
		
	}
	
	public List<VwSyncMktCustomer> findByCustomerNoWithOutSync(String customerCode) throws Exception {
		Map<String,Object> mapWhereValue = new HashMap<String, Object>();				
		mapWhereValue.put("customerCode", customerCode);
		//mapWhereValue.put("syncIsstaging", syncIsstaging);
		//mapWhereValue.put("status", status);
		
		return super.ConvertToYoureObject(super.find("VwSyncMktCustomer.findByCustomerNoWithOutSync", mapWhereValue));
		
	}

}
